<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>后盾人</title>
  </head>
  <body>
    <input type="text" name="password" />
  </body>
  <script>
    const input = document.querySelector(`[name="password"]`);
    input.addEventListener("keyup", e => {
      const value = e.target.value;
      // 正则数组, 同时满足3个条件， 必须有大写字母，数字
      const regs = [/^[a-z0-9]{5,10}$/i, /[A-Z]/, /[0-9]/];
      let state = regs.every(e => e.test(value));
      console.log(state ? "正确" : "密码错误");
    });
  </script>
</html>
